Skip to main content
Version: 4.x.x

ExtractRouteParams


import { ExtractRouteParams } from "@hyper-fetch/core"

Description

Defined in request/request.types.ts:204

Preview

type ExtractRouteParams<T> = string extends T ? NegativeTypes : T extends `${string}:${infer  Param}/${infer  Rest}` ? { [ k in Param | keyof ExtractRouteParams<Rest> ]: ParamType } : T extends `${string}:${infer  Param}` ? { [ k in Param ]: ParamType } : NegativeTypes;

Structure

string extends T ? NegativeTypes : (T extends ${string}:,${infer Param}/,${infer Rest} ? [k in Param | keyof ExtractRouteParams<Rest>]: ParamType : (T extends ${string}:,${infer Param} ? [k in Param]: ParamType : NegativeTypes))